/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bio.jpa.entities;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "file", catalog = "biodb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "File.findAll", query = "SELECT f FROM File f"),
    @NamedQuery(name = "File.findByIdFile", query = "SELECT f FROM File f WHERE f.idFile = :idFile"),
    @NamedQuery(name = "File.findByTitle", query = "SELECT f FROM File f WHERE f.title = :title"),
    @NamedQuery(name = "File.findByFileName", query = "SELECT f FROM File f WHERE f.fileName = :fileName"),
    @NamedQuery(name = "File.findByFileType", query = "SELECT f FROM File f WHERE f.fileType = :fileType"),
    @NamedQuery(name = "File.findByprojectPrjId", query = "SELECT f FROM File f WHERE f.projectPrjId.prjId = :prjId"),
    @NamedQuery(name = "File.findByFileSize", query = "SELECT f FROM File f WHERE f.fileSize = :fileSize"),
    @NamedQuery(name = "File.findByFileDate", query = "SELECT f FROM File f WHERE f.fileDate = :fileDate")})
public class File implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(name = "id_file")
    private Integer idFile;
    @Size(max = 250)
    @Column(name = "title")
    private String title;
    @Size(max = 250)
    @Column(name = "file_name")
    private String fileName;
    @Size(max = 60)
    @Column(name = "file_type")
    private String fileType;
    @Column(name = "file_size")
    private BigInteger fileSize;
    @Basic(optional = false)
    @Column(name = "file_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fileDate;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fileIdFile")
    private List<FileData> fileDataList;
    @JoinColumn(name = "project_prj_id", referencedColumnName = "prj_id")
    @ManyToOne(optional = false)
    private Project projectPrjId;

    public File() {
    }

    public File(Integer idFile) {
        this.idFile = idFile;
    }

    public File(Integer idFile, Date fileDate) {
        this.idFile = idFile;
        this.fileDate = fileDate;
    }

    public Integer getIdFile() {
        return idFile;
    }

    public void setIdFile(Integer idFile) {
        this.idFile = idFile;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFileType() {
        return fileType;
    }

    public void setFileType(String fileType) {
        this.fileType = fileType;
    }

    public BigInteger getFileSize() {
        return fileSize;
    }

    public void setFileSize(BigInteger fileSize) {
        this.fileSize = fileSize;
    }

    public Date getFileDate() {
        return fileDate;
    }

    public void setFileDate(Date fileDate) {
        this.fileDate = fileDate;
    }

    public List<FileData> getFileDataList() {
        return fileDataList;
    }

    public void setFileDataList(List<FileData> fileDataList) {
        this.fileDataList = fileDataList;
    }

    public Project getProjectPrjId() {
        return projectPrjId;
    }

    public void setProjectPrjId(Project projectPrjId) {
        this.projectPrjId = projectPrjId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFile != null ? idFile.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof File)) {
            return false;
        }
        File other = (File) object;
        if ((this.idFile == null && other.idFile != null) || (this.idFile != null && !this.idFile.equals(other.idFile))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bio.jpa.entities.File[ idFile=" + idFile + " ]";
    }
    
}
